package com.viknix.threadpool.manager.http.response;

import com.viknix.threadpool.manager.http.Header;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;

/**
 * @Author: Dongqi
 * @Date: 2021/11/22 10:57
 * @Version 1.0
 * @Description: Represents a client-side HTTP response.
 */
public interface HttpClientResponse extends Closeable {
    
    /**
     * Return the headers of this message.
     *
     * @return a corresponding HttpHeaders object (never {@code null})
     */
    Header getHeaders();
    
    /**
     * Return the body of the message as an input stream.
     *
     * @return String response body
     * @throws IOException IOException
     */
    InputStream getBody() throws IOException;
    
    /**
     * Return the HTTP status code.
     *
     * @return the HTTP status as an integer
     * @throws IOException IOException
     */
    int getStatusCode() throws IOException;
    
    /**
     * Return the HTTP status text of the response.
     *
     * @return the HTTP status text
     * @throws IOException IOException
     */
    String getStatusText() throws IOException;
    
    /**
     * close response InputStream.
     */
    @Override
    void close();
}
